package dome4;

 abstract class Animal {
     public String name;
     public int age;


     public Animal(String name, int age) {
         this.name = name;
         this.age = age;
     }
     public abstract void eat();

 }
     interface IFly {
         void fly();
     }

     interface IRun {
         void run();
     }

     interface ISwim {
         void swim();
     }
 class Dog extends Animal implements IRun{
     public Dog(String name,int age){
         super(name,age);

     }

     @Override
     public void eat() {
         System.out.println(this.name+"正在吃狗粮");
     }

     @Override
     public void run() {
         System.out.println(this.name+"正在用四条腿跑");
     }
 }
 class Frog extends Animal implements IRun,ISwim {

     public Frog(String name, int age) {
         super(name, age);
     }

     @Override
     public void eat() {
         System.out.println(this.name+"正在吃蛙粮");
     }

     @Override
     public void run() {

     }

     @Override
     public void swim() {

     }
 }


class Roboot implements IRun{
    @Override
    public void run() {
        System.out.println("机器人正在跑");
    }
}

     public class Test {
         public static void func1(Animal animal) {
             animal.eat();
         }
         public static void main(String[] args) {
             func1(new Dog("狗",1));
             func1(new Frog("二蛙",2));

         }
     }


